//
//  KVNHouseGraphicsCollectionViewCell.m
//  Test1
//
//  Created by KelvinYeung on 15/8/7.
//  Copyright (c) 2015年 KelvinYeung. All rights reserved.
//

#import "KVNHouseGraphicsCollectionViewCell.h"

@implementation KVNHouseGraphicsCollectionViewCell
@synthesize  houseImageView;
@synthesize valueLabel1;
@synthesize valueLabel2;

- (instancetype) initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    [self initSubViews];
    return self;
}


- (void) initSubViews{
    
    houseImageView = [[UIImageView alloc] init];
    //houseImageView.backgroundColor = [UIColor redColor];
    valueLabel1 = [[UILabel alloc]init];
    valueLabel2 = [[UILabel alloc]init];
    [self.contentView addSubview:houseImageView];
    [self.contentView addSubview:valueLabel1];
    [self.contentView addSubview:valueLabel2];

    
    houseImageView.translatesAutoresizingMaskIntoConstraints = NO;
    valueLabel1.translatesAutoresizingMaskIntoConstraints = NO;
    valueLabel2.translatesAutoresizingMaskIntoConstraints = NO;
    
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:houseImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:houseImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:houseImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:houseImageView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1 constant:-30]];
    

    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:houseImageView attribute:NSLayoutAttributeBottom multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:houseImageView attribute:NSLayoutAttributeLeft multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:houseImageView attribute:NSLayoutAttributeRight multiplier:1 constant:0]];
   // [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:valueLabel2 attribute:NSLayoutAttributeTop multiplier:1 constant:0]];
    
    
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:valueLabel1 attribute:NSLayoutAttributeBottom multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:valueLabel1 attribute:NSLayoutAttributeLeft multiplier:1 constant:0]];
    [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:valueLabel1 attribute:NSLayoutAttributeRight multiplier:1 constant:0]];
    //[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:valueLabel2 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1 constant:0]];
    
    
    
}

@end
